//
//  ProductsItemTo.swift
//  weile
//
//  Created by LKM on 16/10/9.
//  Copyright © 2016年 LKM. All rights reserved.
//

import UIKit
import Foundation
import SwiftyJSON
class ProductsTo: NSObject {
    
    
    var pagesize: Int?;//100000
    var currentpage: Int?;//1
    var totalnum: Int?;//3
    var prolist: [ProductItemM]?;//
    var filters: [ProductsToFilter1]?;//
//    var huxing: [ProductSizeM]?;//
//    var fengge: [ProductStyleM]?;//
    
    //dict["data"].dictionaryObject  dict是JSON
    init?(jsons: [String: JSON]?) {
        super.init()
        if(jsons == nil){
            return nil
        }
        
        if let dict = jsons{
        
        self.pagesize = dict["pagesize"]?.int;//100000
        self.currentpage = dict["currentpage"]?.int;//1
        self.totalnum = dict["totalnum"]?.int;//3
        self.prolist = ProductItemM.initToList(json:  dict["prolist"]  );//
        self.filters=ProductsToFilter1.initToList(json:  dict["filters"] )
//        self.huxing = ProductSizeM.initToList( json:JSON(dict["huxing"] ) );// as? [ProductSizeM];//
//        self.fengge = ProductStyleM.initToList( json:JSON(dict["fengge"]) )// as? [ProductStyleM];//
    }
    }
    
    //initToList( json:JSON(dict["huxing"] ) )  把JSON过的Any转为JSON
    //一定要是JSON要是 [Any] 的话 会装换失败，最后我还是选用这个JSON
    class func initToList(json: JSON)->[ProductsTo?]{
        if let items = json.array {
            var results = [ProductsTo?]()
            for item in items {
                let result = ProductsTo(jsons: item.dictionary )
                //                if(result != nil){//空还加个屁啊  json为“[]” 时 这是不会为空的。除非直接来了个nil
                //                    results.append(result!)
                //                }
                results.append(result)
            }
            return results;
        }
        return [ProductsTo?]()
    }
    
    //initToList( json:JSON(dict["huxing"] ) )  把JSON过的Any转为JSON
    //一定要是JSON要是 [Any] 的话 会装换失败，最后我还是选用这个JSON
    class func initToMap(json: JSON)->Dictionary<String,ProductsTo>{
        if let items = json.dictionary {
            var results = Dictionary<String,ProductsTo>()//取值的时候本身就是可选类型啊,所以这里不用跟数组一样弄可选类型
            for (key, value)  in items {
                let result = ProductsTo(jsons: value.dictionary )
                results[key] = result
            }
            return results;
        }
        return Dictionary<String,ProductsTo>()
    }
    

    
    
    

}



//lkm
class ProductItemM: NSObject {
    
    var id: String?;//"116"
    var goodsName: String?;//"va059 别墅"
    var channelId: Int?;//"582"
    var goodsCode: String?;//"VA059"
    var isHot: Int?;//"0"
    var isMsg: Int?;//"1"
    var isRed: Int?;//"0"
    var isSlide: Int?;//"0"
    var isStartUp: Int?;//"1"
    var isTop: Int?;//"0"
    var sort: Int?;//"1"
    var proimg: String?;//"/UpLoadFiles/20160924/2016092417295565.jpg"
    var sku1: String?;//""
    var sku2: String?;//""
    var sku3: String?;//""
    var sku4: String?;//""
    var sku5: String?;//""
    var keyws: String?;//"别墅|轻钢别墅|小别墅|木别墅|木屋|度假屋"
    
    init?(jsons: [String: JSON]?) {
        super.init()
        if(jsons == nil){
            return nil
        }
        
        if let dict = jsons{
        self.id = dict["id"]?.string;//"116"
        self.goodsName = dict["goodsName"]?.string;//"va059 别墅"
        self.channelId = dict["channelId"]?.int;//"582"
        self.goodsCode = dict["goodsCode"]?.string;//"VA059"
        self.isHot = dict["isHot"]?.int;//"0"
        self.isMsg = dict["isMsg"]?.int;//"1"
        self.isRed = dict["isRed"]?.int;//"0"
        self.isSlide = dict["isSlide"]?.int;//"0"
        self.isStartUp = dict["isStartUp"]?.int;//"1"
        self.isTop = dict["isTop"]?.int;//"0"
        self.sort = dict["sort"]?.int;//"1"
        self.proimg = dict["proimg"]?.string;//"/UpLoadFiles/20160924/2016092417295565.jpg"
        self.sku1 = dict["sku1"]?.string;//""
        self.sku2 = dict["sku2"]?.string;//""
        self.sku3 = dict["sku3"]?.string;//""
        self.sku4 = dict["sku4"]?.string;//""
        self.sku5 = dict["sku5"]?.string;//""
        self.keyws = dict["keyws"]?.string;//"别墅|轻钢别墅|小别墅|木别墅|木屋|度假屋"
        }}
    
    
    //initToList( json:JSON(dict["huxing"] ) )  把JSON过的Any转为JSON
    //一定要是JSON要是 [Any] 的话 会装换失败，最后我还是选用这个JSON
    class func initToList(json js: JSON?)->[ProductItemM]?{
        if(js == nil){
            return nil;
        }
        let json = js!
        if let items = json.array {
            var results = [ProductItemM]()
            for item in items {
                let result = ProductItemM(jsons: item.dictionary ?? [:] )!
//                                if(result != nil){//空还加个屁啊  json为“[]” 时 这是不会为空的。除非直接来了个nil
//                                    results.append(result!)
//                                }
                results.append(result)
            }
            return results;
        }
        return [ProductItemM]()
    }
    
    //initToList( json:JSON(dict["huxing"] ) )  把JSON过的Any转为JSON
    //一定要是JSON要是 [Any] 的话 会装换失败，最后我还是选用这个JSON
    class func initToMap(json: JSON)->Dictionary<String,ProductItemM>{
        if let items = json.dictionary {
            var results = Dictionary<String,ProductItemM>()//取值的时候本身就是可选类型啊,所以这里不用跟数组一样弄可选类型
            for (key, value)  in items {
                let result = ProductItemM(jsons: value.dictionary )
                results[key] = result
            }
            return results;
        }
        return Dictionary<String,ProductItemM>()
    }
    
    
    
    
}
import Foundation
import SwiftyJSON

//lkm
class ProductsToFilter1: NSObject {
    
    var kindid: Int?;//"7"
    var name: String?;//"户型"
    var filter: [ProductsToFilter2]?;//
    
    //dict["data"].dictionaryObject  dict是JSON
    init?(jsons: [String: JSON]?) {
        super.init()
        if(jsons == nil){
            return nil
        }
        
        if let dict = jsons{
        self.kindid = dict["kindid"]?.int;//"7"
        self.name = dict["name"]?.string;//"户型"
        self.filter = ProductsToFilter2.initToList( json: dict["filter"]  ) // dict["filter"]?.string;//
    }
    }
    
    
    //initToList( json:JSON(dict["huxing"] ) )  把JSON过的Any转为JSON
    //一定要是JSON要是 [Any] 的话 会装换失败，最后我还是选用这个JSON
    class func initToList(json js: JSON?)->[ProductsToFilter1]?{
        if(js == nil){
            return nil;
        }
        let json = js!
        if let items = json.array {
            var results = [ProductsToFilter1]()
            for item in items {
                let result = ProductsToFilter1(jsons: item.dictionary ?? [:])!
//                                if(result != nil){//空还加个屁啊  json为“[]” 时 这是不会为空的。除非直接来了个nil
//                                    results.append(result!)
//                                }
                results.append(result)
            }
            return results;
        }
        return [ProductsToFilter1]()
    }
    
    //initToList( json:JSON(dict["huxing"] ) )  把JSON过的Any转为JSON
    //一定要是JSON要是 [Any] 的话 会装换失败，最后我还是选用这个JSON
    class func initToMap(json: JSON)->Dictionary<String,ProductsToFilter1>{
        if let items = json.dictionary {
            var results = Dictionary<String,ProductsToFilter1>()//取值的时候本身就是可选类型啊,所以这里不用跟数组一样弄可选类型
            for (key, value)  in items {
                let result = ProductsToFilter1(jsons: value.dictionary )
                results[key] = result
            }
            return results;
        }
        return Dictionary<String,ProductsToFilter1>()
    }
    
    
    
}


import Foundation
import SwiftyJSON

//lkm
class ProductsToFilter2: NSObject {
    
    var id: String?;//"636"
    var name: String?;//"迷你户型"
    var filterc: String?;//
    
    var isSelect:Bool=false
    
    override init() {
    }
    //dict["data"].dictionaryObject  dict是JSON
    init?(jsons: [String: JSON]?) {
        super.init()
        if(jsons == nil){
            return nil
        }
        
        if let dict = jsons{
        self.id = dict["id"]?.string;//"636"
        self.name = dict["name"]?.string;//"迷你户型"
        self.filterc = dict["filterc"]?.string;//
    }
    }
    
    
    //initToList( json:JSON(dict["huxing"] ) )  把JSON过的Any转为JSON
    //一定要是JSON要是 [Any] 的话 会装换失败，最后我还是选用这个JSON
    class func initToList(json js: JSON?)->[ProductsToFilter2]?{
        if(js == nil){
            return nil;
        }
        let json = js!
        if let items = json.array {
            var results = [ProductsToFilter2]()
            for item in items {
                let result = ProductsToFilter2(jsons: item.dictionary ?? [:])!
//                                if(result != nil){//空还加个屁啊  json为“[]” 时 这是不会为空的。除非直接来了个nil
//                                    results.append(result!)
//                                }
                results.append(result)
            }
            return results;
        }
        return [ProductsToFilter2]()
    }
    
    //initToList( json:JSON(dict["huxing"] ) )  把JSON过的Any转为JSON
    //一定要是JSON要是 [Any] 的话 会装换失败，最后我还是选用这个JSON
    class func initToMap(json: JSON)->Dictionary<String,ProductsToFilter2>{
        if let items = json.dictionary {
            var results = Dictionary<String,ProductsToFilter2>()//取值的时候本身就是可选类型啊,所以这里不用跟数组一样弄可选类型
            for (key, value)  in items {
                let result = ProductsToFilter2(jsons: value.dictionary )
                results[key] = result
            }
            return results;
        }
        return Dictionary<String,ProductsToFilter2>()
    }
    
    
    
    
}


import Foundation
import SwiftyJSON

//lkm
class ProductSizeM: NSObject {
    
    var Id: Int?;//"636"
    var Title: String?;//"四代同堂"
    var Title_e: String?;//""
    var ParentId: Int?;//"0"
    var ClassList: String?;//",636,"
    var ClassLayer: Int?;//"1"
    var ClassOrder: Int?;//"0"
    var PageUrl: String?;//"../shuxing/List.aspx"
    var KindId: Int?;//"7"
    var PicUrl: String?;//""
    var Comments: String?;//""
    var IsTop: Int?;//"0"
    
    init?(jsons: [String: JSON]?) {
        super.init()
        if(jsons == nil){
            return nil
        }
        
        if let dict = jsons{
        
        self.Id = dict["Id"]?.int;//"636"
        self.Title = dict["Title"]?.string;//"四代同堂"
        self.Title_e = dict["Title_e"]?.string;//""
        self.ParentId = dict["ParentId"]?.int;//"0"
        self.ClassList = dict["ClassList"]?.string;//",636,"
        self.ClassLayer = dict["ClassLayer"]?.int;//"1"
        self.ClassOrder = dict["ClassOrder"]?.int;//"0"
        self.PageUrl = dict["PageUrl"]?.string;//"../shuxing/List.aspx"
        self.KindId = dict["KindId"]?.int;//"7"
        self.PicUrl = dict["PicUrl"]?.string;//""
        self.Comments = dict["Comments"]?.string;//""
        self.IsTop = dict["IsTop"]?.int;//"0"
    }
    }
    
    
    //initToList( json:JSON(dict["huxing"] ) )  把JSON过的Any转为JSON
    //一定要是JSON要是 [Any] 的话 会装换失败，最后我还是选用这个JSON
    class func initToList(json: JSON)->[ProductSizeM?]{
        if let items = json.array {
            var results = [ProductSizeM?]()
            for item in items {
                let result = ProductSizeM(jsons: item.dictionary ?? [:])!
//                                if(result != nil){//空还加个屁啊  json为“[]” 时 这是不会为空的。除非直接来了个nil
//                                    results.append(result!)
//                                }
                results.append(result)
            }
            return results;
        }
        return [ProductSizeM?]()
    }
    
    //initToList( json:JSON(dict["huxing"] ) )  把JSON过的Any转为JSON
    //一定要是JSON要是 [Any] 的话 会装换失败，最后我还是选用这个JSON
    class func initToMap(json: JSON)->Dictionary<String,ProductSizeM>{
        if let items = json.dictionary {
            var results = Dictionary<String,ProductSizeM>()//取值的时候本身就是可选类型啊,所以这里不用跟数组一样弄可选类型
            for (key, value)  in items {
                let result = ProductSizeM(jsons: value.dictionary )
                results[key] = result
            }
            return results;
        }
        return Dictionary<String,ProductSizeM>()
    }
    
    
    
    
}
import Foundation
import SwiftyJSON

//lkm
class ProductStyleM: NSObject {
    
    var Id: Int?;//"641"
    var Title: String?;//"梵•罗萨"
    var Title_e: String?;//""
    var ParentId: Int?;//"0"
    var ClassList: String?;//",641,"
    var ClassLayer: Int?;//"1"
    var ClassOrder: Int?;//"1"
    var PageUrl: String?;//"../selectPhone/List.aspx"
    var KindId: Int?;//"8"
    var PicUrl: String?;//""
    var Comments: String?;//""
    var IsTop: Int?;//"0"
    
    init?(jsons: [String: JSON]?) {
        super.init()
        if(jsons == nil){
            return nil
        }
        
        if let dict = jsons{
        
        self.Id = dict["Id"]?.int;//"641"
        self.Title = dict["Title"]?.string;//"梵•罗萨"
        self.Title_e = dict["Title_e"]?.string;//""
        self.ParentId = dict["ParentId"]?.int;//"0"
        self.ClassList = dict["ClassList"]?.string;//",641,"
        self.ClassLayer = dict["ClassLayer"]?.int;//"1"
        self.ClassOrder = dict["ClassOrder"]?.int;//"1"
        self.PageUrl = dict["PageUrl"]?.string;//"../selectPhone/List.aspx"
        self.KindId = dict["KindId"]?.int;//"8"
        self.PicUrl = dict["PicUrl"]?.string;//""
        self.Comments = dict["Comments"]?.string;//""
        self.IsTop = dict["IsTop"]?.int;//"0"
    }
    }
    
    
    //initToList( json:JSON(dict["huxing"] ) )  把JSON过的Any转为JSON
    //一定要是JSON要是 [Any] 的话 会装换失败，最后我还是选用这个JSON
    class func initToList(json: JSON)->[ProductStyleM?]{
        if let items = json.array {
            var results = [ProductStyleM?]()
            for item in items {
                let result = ProductStyleM(jsons: item.dictionary )
                //                if(result != nil){//空还加个屁啊  json为“[]” 时 这是不会为空的。除非直接来了个nil
                //                    results.append(result!)
                //                }
                results.append(result)
            }
            return results;
        }
        return [ProductStyleM?]()
    }
    
    //initToList( json:JSON(dict["huxing"] ) )  把JSON过的Any转为JSON
    //一定要是JSON要是 [Any] 的话 会装换失败，最后我还是选用这个JSON
    class func initToMap(json: JSON)->Dictionary<String,ProductStyleM>{
        if let items = json.dictionary {
            var results = Dictionary<String,ProductStyleM>()//取值的时候本身就是可选类型啊,所以这里不用跟数组一样弄可选类型
            for (key, value)  in items {
                let result = ProductStyleM(jsons: value.dictionary )
                results[key] = result
            }
            return results;
        }
        return Dictionary<String,ProductStyleM>()
    }
    

    
    
}



